package lc.q150_200;

public class Q167 {
    public int[] twoSum(int[] numbers, int target) {
        // 左右指针法
        int i=0,j = numbers.length - 1;
        while (i < j) {
            int sum = numbers[i] + numbers[j];
            if (sum == target) {
                return new int[]{i + 1, j + 1};
            } else if (sum < target) {
                i ++;
            } else {
                j --;
            }
        }
        return new int[]{-1,-1};
    }
    

}
